ComponentOne Studio for WinRT XAML
DeferNotifications メソッド
使用例 

返される System.IDisposable オブジェクトが破棄されるまで、通知を一時停止します。
構文
'宣言
 
Public Function DeferNotifications() As System.IDisposable
public System.IDisposable DeferNotifications()

戻り値の型

これが破棄されるまで通知が再開されない System.IDisposable オブジェクト。
解説
このメソッドは一般に、バッチ更新を効率よく安全に実行するためにアップデートブロックで使用されます。
使用例

以下のサンプルは、グリッドで複数の列の幅を設定する間、DeferNotifications メソッドを使用して通知を一時停止する方法を示します。

DeferNotifications メソッドの呼び出しが using 文に置かれていることに注意してください。これにより、ブロック内のコードが例外を生成した場合でも、オブジェクトが自動的に破棄され、ブロックの終りで通知が再開されます。これは、try/finally ブロック内で BeginUpdate メソッドと EndUpdate メソッドを呼び出す従来の方法より、コードが読みやすく簡潔です。

var grid = new C1FlexGrid();
using (grid.Columns.DeferNotifications())
{
  foreach (var col in grid.Columns)
  {
    col.Width = 100;
  }
}
参照

RowColCollection<T> クラス
RowColCollection<T> メンバ

 

 


Copyright © GrapeCity inc. All rights reserved.